package com.iflytek.exam.mapper;

import java.util.List;
import com.iflytek.exam.domain.ExamSet;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 试卷属性设置Mapper接口
 *
 * @author Dogdog
 * @date 2024-07-09
 */
@Mapper
public interface ExamSetMapper
{
    /**
     * 查询试卷属性设置
     *
     * @param id 试卷属性设置主键
     * @return 试卷属性设置
     */
    public ExamSet selectExamSetById(Long id);

    /**
     * 查询试卷属性设置列表
     *
     * @param examSet 试卷属性设置
     * @return 试卷属性设置集合
     */
    public List<ExamSet> selectExamSetList(ExamSet examSet);

    /**
     * 新增试卷属性设置
     *
     * @param examSet 试卷属性设置
     * @return 结果
     */
    public int insertExamSet(ExamSet examSet);

    /**
     * 修改试卷属性设置
     *
     * @param examSet 试卷属性设置
     * @return 结果
     */
    public int updateExamSet(ExamSet examSet);

    /**
     * 删除试卷属性设置
     *
     * @param id 试卷属性设置主键
     * @return 结果
     */
    public int deleteExamSetById(Long id);

    /**
     * 批量删除试卷属性设置
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteExamSetByIds(Long[] ids);

    @Select("select * from tb_exam_set where exam_id = #{examIds}")
    ExamSet selectExamSetByIds(@Param("examIds") Long[] examIds);

    @Delete("delete from tb_exam_set where exam_id = #{examId}")
    Boolean deleteExamSetByExamId(Long examId);

    ExamSet selectExamSetByExamId(Long examId);

    @Select("select id, exam_id, retakes_num, is_look, is_max, states, type, " +
            "paper_mode, forced_winding, password_type, create_time, update_time from tb_exam_set " +
            "where exam_id = #{examId} ")
    ExamSet selectExamSetByExamIdAndUserId(@Param("examId") Long examId, @Param("userId") Long userId);

}
